package tech.yunjing.train.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import tech.yunjing.train.entity.UserInfo;
import tech.yunjing.train.service.LoginService;
import tech.yunjing.train.util.JsonResult;


/**
 * purpose: 登录
 * Created by 吕祥 on 2017/6/11.
 */
@RestController
@RequestMapping(value = "Login")
public class LoginContorller extends BaseController{

    @Autowired
    LoginService<UserInfo> loginService;

    /**
     * 用户登录并保存到Redis
     * @param userAccount 用户账号
     * @param userPassword 用户密码
     * @return
     */
    @RequestMapping(value = "/userInfo", method = RequestMethod.POST)
    public JsonResult userLoginPut(String userAccount, String userPassword) {
        return new JsonResult(loginService.userLoginSave(userAccount,userPassword));
    }
}
